<%@page import="com.shoeshopping.entity.User"%>
<%@page import="com.shoeshopping.entity.Goods"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";

	List goodses = (List) request.getAttribute("goodses");
	User user = ((User) session.getAttribute("user"));
	String username = null;
	if (user != null) {
		username = user.getUsername();
	}
%>

<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">

<title>Home</title>
<link href="css/style.css" rel='stylesheet' type='text/css' />
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
</script>
<!----webfonts---->
<link href='css/css.css?family=Open+Sans:400,300,600,700,800'
	rel='stylesheet' type='text/css'></link>
<!----//webfonts---->
<!----start-alert-scroller---->
<script src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.easy-ticker.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$('#demo').hide();
		$('.vticker').easyTicker();
	});
</script>
<!----start-alert-scroller---->
<!-- start menu -->
<link href="css/megamenu.css" rel="stylesheet" type="text/css"
	media="all" />
<script type="text/javascript" src="js/megamenu.js"></script>
<script>
	$(document).ready(function() {
		$(".megamenu").megamenu();
	});
</script>
<script src="js/menu_jquery.js"></script>
<!-- //End menu -->
<!---slider---->
<link rel="stylesheet" href="css/slippry.css">
<script src="js/jquery-ui.js" type="text/javascript"></script>
<script src="js/scripts-f0e4e0c2.js" type="text/javascript"></script>
<script>
	jQuery('#jquery-demo').slippry({
		// general elements & wrapper
		slippryWrapper : '<div class="sy-box jquery-demo" />', // wrapper to wrap everything, including pager
		// options
		adaptiveHeight : false, // height of the sliders adapts to current slide
		useCSS : false, // true, false -> fallback to js if no browser support
		autoHover : false,
		transition : 'fade'
	});
	//var tmp = <s:property value='session.get("username")'/>;
	alert(tmp);
</script>
<!----start-pricerage-seletion---->
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery-ui.css">

<!----//End-pricerage-seletion---->
<!---move-top-top---->
<script type="text/javascript" src="js/move-top.js"></script>
<script type="text/javascript" src="js/easing.js"></script>
<script type="text/javascript">
	jQuery(document).ready(function($) {
		$(".scroll").click(function(event) {
			event.preventDefault();
			$('html,body').animate({
				scrollTop : $(this.hash).offset().top
			}, 1200);
		});
	});
</script>
<!---//move-top-top---->
</head>
<body>
	<!---start-wrap---->
	<!---start-header---->
	<div class="header">
		<%
			//jsp include进 top-header
		%>
		<jsp:include page="/component/top-header.jsp" flush="true">
			<jsp:param value='<%=username %>' name="username" />
		</jsp:include>

		<%
			//jsp include进 middle-header
		%>
		<jsp:include page="/component/middle-header.jsp" flush="true" />

		<%
			//jsp include进 middle-header
		%>
		<jsp:include page="/component/bottom-header.jsp" flush="true" />

	</div>

	<!----//End-bottom-header---->
	<!---//End-header---->
	<!----start-image-slider---->
	</div>
	<div class="clear"></div>
	<div class="content">
		<div class="wrap">
			<div class="content-right">
				<div class="product-grids">
					<!--- start-rate---->
					<script type="text/javascript">
						jQuery(function() {
							jQuery('.starbox')
									.each(
											function() {
												var starbox = jQuery(this);
												starbox
														.starbox(
																{
																	average : starbox
																			.attr('data-start-value'),
																	changeable : starbox
																			.hasClass('unchangeable') ? false
																			: starbox
																					.hasClass('clickonce') ? 'once'
																					: true,
																	ghosting : starbox
																			.hasClass('ghosting'),
																	autoUpdateAverage : starbox
																			.hasClass('autoupdate'),
																	buttons : starbox
																			.hasClass('smooth') ? false
																			: starbox
																					.attr('data-button-count') || 5,
																	stars : starbox
																			.attr('data-star-count') || 5
																})
														.bind(
																'starbox-value-changed',
																function(event,
																		value) {
																	if (starbox
																			.hasClass('random')) {
																		var val = Math
																				.random();
																		starbox
																				.next()
																				.text(
																						' '
																								+ val);
																		return val;
																	}
																})
											});
						});
					</script>
					<!---//End-rate---->
					<!---caption-script---->
					<!---//caption-script---->

					<%
						//for循环生成商品
					%>
					<%
						for (int i = 1; i < goodses.size(); i++) {
							Goods goods = (Goods) goodses.get(i);
							if (i % 3 == 0) {
								//
					%>
					<jsp:include page="/component/goodItemLast.jsp" flush="true">
						<jsp:param value="<%=goods.getName() %>" name="name" />
						<jsp:param value="<%=goods.getPrice() %>" name="price" />
						<jsp:param value="<%= goods.getImgPath()%>" name="imgPath" />
						<jsp:param value="<%= goods.getId()%>" name="goodsId" />

					</jsp:include>
					<%
						} else {
					%>
					<jsp:include page="/component/goodItem.jsp" flush="true">
						<jsp:param value="<%=goods.getName() %>" name="name" />
						<jsp:param value="<%=goods.getPrice() %>" name="price" />
						<jsp:param value="<%= goods.getImgPath()%>" name="imgPath" />
						<jsp:param value="<%= goods.getId()%>" name="goodsId" />
					</jsp:include>
					<%
						}
						}
					%>
					<div class="clear"></div>
				</div>
			</div>
			<div class="clear"></div>
		</div>
	</div>
</body>
</html>

